<?php
//set style
$aCSS = array(assets('css/jquery.fancybox.css', true));
$aJS = array(assets('js/jquery.fancybox.pack.js', true));

$this->frontend_lib->setACss($aCSS);
$this->frontend_lib->setAJs($aJS);
?>

<div class="row">
	<div class="col-md-12 col-xs-12" id="crumbs">
        <h2 class="title text-center">Tin tức</h2>
    </div>
</div>

<div class="row">
    <div class="col-md-8 col-xs-12">
        <h3 class="item-title f20px clear-mgr clear-pad"><?php echo $post->getTitle();?></h3>
    </div>
    <div class="col-md-4 col-xs-12">
        <div class="pager-area pull-right">
    		<?php
    			$nextUrl = null;
    			$nextTitle = null;
    			$prevUrl = null;
    			$prevTitle = null;
    			if($nextPost != null){
    				$nextUrl = post_single_url($nextPost->getSlug());
    				$nextTitle = $nextPost->getTitle();
    			}
    			if($prevPost != null){
    				$prevUrl = post_single_url($prevPost->getSlug());
    				$prevTitle = $prevPost->getTitle();
    			}
    			echo $this->mypaging->getSinglePagerBar($prevUrl, $prevTitle, $nextUrl, $nextTitle, 'Trước', 'Tiếp', 'clear-mgr clear-pad');
    		?>
        </div>
    </div>
</div>

<div class="row">
    <div class="col-md-9 col-xs-12">
        <div class="row">
        	<div class="col-md-12 col-xs-12">
                <div class="visible-xs visible-sm">
                    <p class="mgt10"><i>Đăng ngày: <?php echo $post->getCreatedAt(); ?></i></p>
                    <p class="text-hyphens"><strong><?php echo $post->getDescription(); ?></strong></p>
                </div>
        	</div>

            <?php
                $img_thumb = '';
                $img_org = '';
                if($post->getImage()!='' && image_exist('public/' . $post->image_folder . '/post/' . $post->getImage())) {
                    $img_thumb = post_upload($post->getImage(), $post->image_folder);
                    $img_org = post_upload($post->getImage(), $post->image_folder, false);
                } else {
                    $img_thumb = "http://placehold.it/" . urlencode('130x130&text=Hình đại diện');
                    $img_org = $img_thumb;
                }
            ?>

        	<div class="col-md-5 col-xs-12 media mgt10">
                <a class="fancybox thumbnail no-bdr clear-pad" href="<?php echo $img_org; ?>" title="<?php echo $post->getTitle(); ?>">
                    <img class="media-object post-item lazy"
                        src="<?php echo assets('images/blank.gif', true); ?>"
                        data-src="<?php echo $img_thumb; ?>"
                        alt="<?php echo $post->getTitle(); ?>" />
                </a>
            </div>
            <div class="col-md-7 col-xs-12 mgt10 visible-md visible-lg">
                <i>Đăng ngày: <?php echo $post->getCreatedAt(); ?></i>
                <p class="text-hyphens"><strong><?php echo $post->getDescription(); ?></strong></p>
            </div>
            <div class="clearfix"></div>

        	<div class="col-xs-12 col-md-12 text-hyphens" id="post-content">
        		<?php echo $post->getContent(); ?>
        	</div>
        </div>
    </div>

    <div class="col-md-3 col-xs-12">
        <div class="list-group mgt10 clear-radius">
            <?php foreach($aPostCate as $cate) { ?>
            <?php
                $active_class = '';
                $active_icon  = '';
                if($post->post_cate_slug==$cate->getSlug()){
                    $active_class = 'active';
                    $active_icon = "<i class='glyphicon glyphicon-chevron-right'></i>&nbsp;";
                }
            ?>
    		<a class="list-group-item clear-radius <?php echo $active_class; ?>" href="<?php echo post_cate_url($cate->getSlug()); ?>">
                <?php echo $active_icon . $cate->getTitle(); ?>
            </a>
    		<?php } ?>
    	</div>
    </div>
</div>